
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="口袋鼠统计">
    <link rel="shortcut icon" href="">

    <title>口袋鼠统计登录</title>

    <!-- Bootstrap core CSS -->
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="/css/font-awesome.css" rel="stylesheet" />
    <script src="/js/jquery.min.js"></script>
    <!-- Custom styles for this template -->
    <link href="/css/style.css" rel="stylesheet">
    <link href="/css/style-responsive.css" rel="stylesheet" />
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
    <script src="/js/html5shiv.js"></script>
    <script src="/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="login-body">

<div class="container">

            <form action="javascript:void(0)" method="" class="form-signin">
        <h2 class="form-signin-heading">口袋鼠统计登录</h2>
        <div class="login-wrap">
            <input type="text" class="form-control"  id="name" placeholder="手机号" autofocus>
            <input type="password" class="form-control" id="pwd"  placeholder="密 码">
            <button class="btn btn-lg btn-login btn-block" type="submit" >登 录</button>
            <div class="alert alert-block alert-danger hide inform">
                <i class=" icon-frown"> </i> <strong></strong>
            </div>
                                                                                                                                                                        
        </div>

    </form>

</div>
<script type="text/javascript">
    $(document).on('click','.btn-login',function () {
        var name = document.getElementById("name").value;
        var pwd = document.getElementById("pwd").value;

        if(name == ""){
            $(".inform").removeClass("hide");
            $(".inform strong").text("请输入账号！");
            $("#name").focus();
            return false;
        }

        if(pwd == ""){
            $(".inform").removeClass("hide");
            $(".inform strong").text("请输入正确的密码！")
            $("#pwd").focus();
            return false;
        }

        var obj = new Object();
        obj.mobile = name;
        obj.password = pwd;
        $.post("login",obj,function(msg){
            if (msg.code!= 20000) {
                alert(msg.message);
            }else{
                window.location.href='<?= yii\helpers\Url::to(['/sign/index'])?>';
            }
        },'json');
    });
    </script>
</body>
</html>
